<?php
function sub ($a,$b){
  return $a-$b;
}
function get ($name){
  return isset($_GET[$name])? $_GET[$name]:'';
}
function post ($name){
  return isset($_GET[$name])? $_GET[$name]:'';
}
$a = post('a');
$b = post('b')''
$result = sub ($a,$b);
?>

<form action="" method="post">
  <input type="text" value="<?php echo $a; ?>" name="a"/>+
  <input type="text" name="b" value="<?php echo $b; ?>"/><?php echo $result;
?><br/>
<input type="submit"/>
</form>
